package edu.gdin.ecommerce.model;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import edu.gdin.ecommerce.util.DateUtil;
import edu.gdin.ecommerce.util.DicConverter;

/**
 * OperLog entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_oper_log", catalog = "ecommerce")
public class OperLog implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 5820845690725528990L;
	private Integer operLogId;
	private String type;
	private String result;
	private Date operTime;
	private String operIp;
	private String account;
	private String attachNo;
	private String operDesc;

	// Constructors

	/** default constructor */
	public OperLog() {
	}

	/** full constructor */
	public OperLog(String type, String result, Date operTime,
			String operIp, String account, String attachNo, String operDesc) {
		this.type = type;
		this.result = result;
		this.operTime = operTime;
		this.operIp = operIp;
		this.account = account;
		this.attachNo = attachNo;
		this.operDesc = operDesc;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "OPER_LOG_ID", unique = true, nullable = false)
	public Integer getOperLogId() {
		return this.operLogId;
	}

	public void setOperLogId(Integer operLogId) {
		this.operLogId = operLogId;
	}

	@Column(name = "TYPE", nullable = false, length = 4)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "RESULT", nullable = false, length = 2)
	public String getResult() {
		return this.result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	@Column(name = "OPER_TIME", nullable = false, length = 19)
	public Date getOperTime() {
		return this.operTime;
	}

	public void setOperTime(Date operTime) {
		this.operTime = operTime;
	}

	@Column(name = "OPER_IP", length = 30)
	public String getOperIp() {
		return this.operIp;
	}

	public void setOperIp(String operIp) {
		this.operIp = operIp;
	}

	@Column(name = "ACCOUNT", length = 20)
	public String getAccount() {
		return this.account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	@Column(name = "ATTACH_NO", length = 30)
	public String getAttachNo() {
		return this.attachNo;
	}

	public void setAttachNo(String attachNo) {
		this.attachNo = attachNo;
	}

	@Column(name = "OPER_DESC", length = 200)
	public String getOperDesc() {
		return this.operDesc;
	}

	public void setOperDesc(String operDesc) {
		this.operDesc = operDesc;
	}
	
	
	// -- property Converter --
	
	public String operTimeToString() {
		return DateUtil.dateFormat(this.operTime);
	}
	
	public String typeToString() {
		return DicConverter.dicMapConvert("DIC_LOG_OPER_TYPE", this.getType());
	}
	
	public String resultToString() {
		return DicConverter.dicMapConvert("DIC_LOG_OPER_RESULT", this.getResult());
	}

}